<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>CentOS 7 搭建 LAMP 环境安装 WordPress | AiKIKI</title><meta name="author" content="樵子"><meta name="copyright" content="樵子"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="referrer" content="no-referrer"><meta name="description" content="安装 Apache web 服务器安装 Apache web 服务器1yum install -y httpd  配置 Apache 服务器WordPress 使用了 Url 重写技术，需要在 Apache 中开启。Apache 使用 mod_rewrite 模块来实现 Url 重写，需要在 Apache 的配置文件中打开。修改 Apache 配置文件： 1sudo nano &#x2F;etc&#x2F;httpd">
<meta property="og:type" content="article">
<meta property="og:title" content="CentOS 7 搭建 LAMP 环境安装 WordPress">
<meta property="og:url" content="https://www.aikiki.top/post/e4e5/index.html">
<meta property="og:site_name" content="AiKIKI">
<meta property="og:description" content="安装 Apache web 服务器安装 Apache web 服务器1yum install -y httpd  配置 Apache 服务器WordPress 使用了 Url 重写技术，需要在 Apache 中开启。Apache 使用 mod_rewrite 模块来实现 Url 重写，需要在 Apache 的配置文件中打开。修改 Apache 配置文件： 1sudo nano &#x2F;etc&#x2F;httpd">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif">
<meta property="article:published_time" content="2019-05-09T18:24:00.000Z">
<meta property="article:modified_time" content="2023-11-16T08:35:49.000Z">
<meta property="article:author" content="樵子">
<meta property="article:tag" content="CentOS">
<meta property="article:tag" content="WordPress">
<meta property="article:tag" content="Apache">
<meta property="article:tag" content="MariaDB">
<meta property="article:tag" content="PHP">
<meta property="article:tag" content="phpMyAdmin">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/favicon.ico"><link rel="canonical" href="https://www.aikiki.top/post/e4e5/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'CentOS 7 搭建 LAMP 环境安装 WordPress',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-11-16 16:35:49'
}</script><script>(win=>{
      win.saveToLocal = {
        set: (key, value, ttl) => {
          if (ttl === 0) return
          const now = Date.now()
          const expiry = now + ttl * 86400000
          const item = {
            value,
            expiry
          }
          localStorage.setItem(key, JSON.stringify(item))
        },
      
        get: key => {
          const itemStr = localStorage.getItem(key)
      
          if (!itemStr) {
            return undefined
          }
          const item = JSON.parse(itemStr)
          const now = Date.now()
      
          if (now > item.expiry) {
            localStorage.removeItem(key)
            return undefined
          }
          return item.value
        }
      }
    
      win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        script.onerror = reject
        script.onload = script.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          script.onload = script.onreadystatechange = null
          resolve()
        }

        Object.keys(attr).forEach(key => {
          script.setAttribute(key, attr[key])
        })

        document.head.appendChild(script)
      })
    
      win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onerror = reject
        link.onload = link.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          link.onload = link.onreadystatechange = null
          resolve()
        }
        document.head.appendChild(link)
      })
    
      win.activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
        if (t === 'dark') activateDarkMode()
        else if (t === 'light') activateLightMode()
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
      const detectApple = () => {
        if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
          document.documentElement.classList.add('apple')
        }
      }
      detectApple()
    })(window)</script><meta name="generator" content="Hexo 7.0.0"><link rel="alternate" href="/atom.xml" title="AiKIKI" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/avatar.png" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">28</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif')"><nav id="nav"><span id="blog-info"><a href="/" title="AiKIKI"><span class="site-name">AiKIKI</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">CentOS 7 搭建 LAMP 环境安装 WordPress</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2019-05-09T18:24:00.000Z" title="发表于 2019-05-10 02:24:00">2019-05-10</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-11-16T08:35:49.000Z" title="更新于 2023-11-16 16:35:49">2023-11-16</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Archives/">Archives</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.8k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>6分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="CentOS 7 搭建 LAMP 环境安装 WordPress"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="安装-Apache-web-服务器"><a href="#安装-Apache-web-服务器" class="headerlink" title="安装 Apache web 服务器"></a>安装 Apache web 服务器</h1><h2 id="安装-Apache-web-服务器-1"><a href="#安装-Apache-web-服务器-1" class="headerlink" title="安装 Apache web 服务器"></a>安装 Apache web 服务器</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install -y httpd</span><br></pre></td></tr></table></figure>

<h2 id="配置-Apache-服务器"><a href="#配置-Apache-服务器" class="headerlink" title="配置 Apache 服务器"></a>配置 Apache 服务器</h2><p>WordPress 使用了 Url 重写技术，需要在 Apache 中开启。<br>Apache 使用 mod_rewrite 模块来实现 Url 重写，需要在 Apache 的配置文件中打开。<br>修改 Apache 配置文件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo nano /etc/httpd/conf/httpd.conf</span><br></pre></td></tr></table></figure>

<p>搜索</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># LoadModule rewrite_module modules/mod_rewrite.so</span></span><br></pre></td></tr></table></figure>

<p>将前面的<code>#</code>号去掉，如果没有加上该行即可。<br>搜索</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">AllowOverride</span> <span class="string">None</span></span><br></pre></td></tr></table></figure>

<p>替换为</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">AllowOverride</span> <span class="string">All</span></span><br></pre></td></tr></table></figure>

<h2 id="启动-Apache-服务器并设置为开机启动"><a href="#启动-Apache-服务器并设置为开机启动" class="headerlink" title="启动 Apache 服务器并设置为开机启动"></a>启动 Apache 服务器并设置为开机启动</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl start httpd</span><br><span class="line">systemctl <span class="built_in">enable</span> httpd</span><br></pre></td></tr></table></figure>

<h2 id="Apache-服务器测试"><a href="#Apache-服务器测试" class="headerlink" title="Apache 服务器测试"></a>Apache 服务器测试</h2><p>使用浏览器打开 <a target="_blank" rel="noopener" href="http://127.0.0.1/">http://127.0.0.1/</a> 检查 Apache 安装是否成功。 成功后，浏览器显示如下：</p>
<p><a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/1041711867.png"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/1041711867.png" alt="1041711867.png"></a></p>
<h1 id="安装-MariaDB-数据库"><a href="#安装-MariaDB-数据库" class="headerlink" title="安装 MariaDB 数据库"></a>安装 MariaDB 数据库</h1><p>MariaDB 数据库管理系统是 MySQL 的一个分支，主要由开源社区在维护，采用 GPL 授权许可。MariaDB 的目的是完全兼容 MySQL，包括 API 和命令行，使之能轻松成为 MySQL 的代替品。使用这个分支的原因是：甲骨文公司收购了 MySQL 后，有将 MySQL 闭源的潜在风险，因此社区采用分支的方式来避开这个风险。 目前众多大型互联网用户以及 Linux 发行商纷纷抛弃 MySQL，转投 MariaDB 阵营。MariaDB 是目前最受关注的 MySQL 数据库衍生版，也被视为开源数据库 MySQL 的替代品。MariaDB 虽然被视为 MySQL 数据库的替代品，但它在扩展功能、存储引擎以及一些新的功能改进方面都强过 MySQL。</p>
<h2 id="安装-MariaDB-数据库-1"><a href="#安装-MariaDB-数据库-1" class="headerlink" title="安装 MariaDB 数据库"></a>安装 MariaDB 数据库</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install mariadb-server mariadb</span><br></pre></td></tr></table></figure>

<h2 id="启动-MariaDB-数据库并设置为开机启动"><a href="#启动-MariaDB-数据库并设置为开机启动" class="headerlink" title="启动 MariaDB 数据库并设置为开机启动"></a>启动 MariaDB 数据库并设置为开机启动</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl start mariadb</span><br><span class="line">systemctl <span class="built_in">enable</span> mariadb</span><br></pre></td></tr></table></figure>

<h2 id="安装数据库安全脚本"><a href="#安装数据库安全脚本" class="headerlink" title="安装数据库安全脚本"></a>安装数据库安全脚本</h2><p>安装数据库安全脚本，去掉危险默认设置：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mysql_secure_installation</span><br></pre></td></tr></table></figure>

<p>按提示输入数据库 root 账户的密码，如果是新安装侧输入空格后设置 root 账户的新密码。</p>
<p><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/2488139859.png" alt="2488139859.png"></p>
<p>输入空格后设置 root 账户密码。</p>
<p><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3639214174.png" alt="3639214174.png"></p>
<p>接下来的安装一路回车即可。</p>
<p><a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/7522703.png"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/7522703.png" alt="7522703.png"></a></p>
<h1 id="安装-PHP5-6"><a href="#安装-PHP5-6" class="headerlink" title="安装 PHP5.6"></a>安装 PHP5.6</h1><p>WordPress 官方网站发布的最新版本是 5.2，要求 PHP 最低版本为 5.6。而 CentOS 7 默认源是 5.4 版，因此需要配置 yum 源来安装 5.6 版。</p>
<h2 id="查询软件包"><a href="#查询软件包" class="headerlink" title="查询软件包"></a>查询软件包</h2><p>默认情况下 CentOS 自带的只有 5.4 版本。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum provides php</span><br></pre></td></tr></table></figure>

<h2 id="移除系统已经安装的-PHP"><a href="#移除系统已经安装的-PHP" class="headerlink" title="移除系统已经安装的 PHP"></a>移除系统已经安装的 PHP</h2><p>如果系统已经安装其它版本的 PHP，先移除系统的自带版本。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum remove php-common -y</span><br></pre></td></tr></table></figure>

<h2 id="配置-CentOS-7-高版本-PHP-的源"><a href="#配置-CentOS-7-高版本-PHP-的源" class="headerlink" title="配置 CentOS 7 高版本 PHP 的源"></a>配置 CentOS 7 高版本 PHP 的源</h2><p>高版本的 PHP 源需要手动配置。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm</span><br><span class="line">rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm</span><br></pre></td></tr></table></figure>

<p>查看可安装包<br>使用 yum list 命令查看可安装的包(Packege)：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum list --enablerepo=remi --enablerepo=remi-php56 | grep php</span><br></pre></td></tr></table></figure>

<h2 id="安装-PHP-5-6"><a href="#安装-PHP-5-6" class="headerlink" title="安装 PHP 5.6"></a>安装 PHP 5.6</h2><p>yum 源配置好之后，就可以安装 PHP 5.6。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">yum install epel-release</span><br><span class="line">yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring</span><br><span class="line"></span><br><span class="line"><span class="comment"># 如需安装 php-fpm（例如：FastCGI） 按以下步骤执行，这里会提示多个安装源，选择5.6版本即可。</span></span><br><span class="line">yum provides php-fpm</span><br><span class="line">yum install php56w-fpm-5.6.31-1.w7.x86_64 -y</span><br></pre></td></tr></table></figure>

<h2 id="查看-PHP-安装版本"><a href="#查看-PHP-安装版本" class="headerlink" title="查看 PHP 安装版本"></a>查看 PHP 安装版本</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">php -v</span><br></pre></td></tr></table></figure>

<p>安装成功，系统显示 php 相关信息。</p>
<h2 id="重启-Apache-服务器"><a href="#重启-Apache-服务器" class="headerlink" title="重启 Apache 服务器"></a>重启 Apache 服务器</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl restart httpd</span><br></pre></td></tr></table></figure>

<h2 id="创建-PHP-测试页面"><a href="#创建-PHP-测试页面" class="headerlink" title="创建 PHP 测试页面"></a>创建 PHP 测试页面</h2><p>在网站目录（默认目录为：&#x2F;var&#x2F;www&#x2F;html） 新建 info.php 文件测试 PHP：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo nano /var/www/html/info.php</span><br></pre></td></tr></table></figure>

<p>输入如下内容：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span> <span class="title function_ invoke__">phpinfo</span>();<span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>

<h2 id="测试-Apache-服务器-PHP"><a href="#测试-Apache-服务器-PHP" class="headerlink" title="测试 Apache 服务器 PHP"></a>测试 Apache 服务器 PHP</h2><p>用浏览器打开 <a target="_blank" rel="noopener" href="http://127.0.0.1/info.php">http://127.0.0.1/info.php</a> 显示内容如下：</p>
<p><a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3933973293.png"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3933973293.png" alt="3933973293.png"></a></p>
<h2 id="附：配置-Apache-以-FastCGI-运行-PHP"><a href="#附：配置-Apache-以-FastCGI-运行-PHP" class="headerlink" title="附：配置 Apache 以 FastCGI 运行 PHP"></a>附：配置 Apache 以 FastCGI 运行 PHP</h2><p>Apache 默认是用自带的 mod_php 模块运行 PHP，我们可以使用 FastCGI 来执行 PHP 脚本。</p>
<p>编辑 Apache 配置文件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/httpd/conf/httpd.conf</span><br></pre></td></tr></table></figure>

<p>按以下说明修改：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 增加 php-fpm 相关支持模块</span></span><br><span class="line"><span class="string">LoadModule</span> <span class="string">proxy_module</span> <span class="string">modules/mod_proxy.so</span></span><br><span class="line"><span class="string">LoadModule</span> <span class="string">proxy_fcgi_module</span> <span class="string">modules/mod_proxy_fcgi.so</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 增加 index.php 默认页</span></span><br><span class="line"></span><br><span class="line"><span class="string">&lt;IfModule</span> <span class="string">dir_module&gt;</span></span><br><span class="line">    <span class="string">DirectoryIndex</span> <span class="string">index.html</span> <span class="string">index.php</span></span><br><span class="line"></span><br><span class="line"><span class="string">&lt;/IfModule&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 增加 PHP 解析类型</span></span><br><span class="line"><span class="string">AddType</span> <span class="string">application/x-httpd-php</span> <span class="string">.php</span></span><br><span class="line"><span class="string">AddType</span> <span class="string">application/x-httpd-php-source</span> <span class="string">.php</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 增加 php-fpm</span></span><br><span class="line"></span><br><span class="line"><span class="string">&lt;FilesMatch</span> <span class="string">\.php$&gt;</span></span><br><span class="line">    <span class="string">SetHandler</span> <span class="string">&quot;proxy:fcgi://127.0.0.1:9000&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&lt;/FilesMatch&gt;</span></span><br></pre></td></tr></table></figure>

<h1 id="安装-phpMyAdmin"><a href="#安装-phpMyAdmin" class="headerlink" title="安装 phpMyAdmin"></a>安装 phpMyAdmin</h1><p>phpMyAdmin 是一个 MariaDB 数据的 Web 管理系统。</p>
<h2 id="安装-phpMyAdmin-1"><a href="#安装-phpMyAdmin-1" class="headerlink" title="安装 phpMyAdmin"></a>安装 phpMyAdmin</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># 安装 EPEL库，如果之前已经安装可以跳过此步。</span><br><span class="line">yum install -y epel-release</span><br><span class="line"></span><br><span class="line"># 安装 phpMyAdmin。</span><br><span class="line">yum install -y phpmyadmin</span><br></pre></td></tr></table></figure>

<h2 id="配置-phpMyAdmin-的-httpd"><a href="#配置-phpMyAdmin-的-httpd" class="headerlink" title="配置 phpMyAdmin 的 httpd"></a>配置 phpMyAdmin 的 httpd</h2><p>配置文件为：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo nano /etc/httpd/conf.d/phpMyAdmin.conf</span><br></pre></td></tr></table></figure>

<p>按图中所示修改配置文件：</p>
<p><a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/209675648.png"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/209675648.png" alt="209675648.png"></a></p>
<h2 id="重启-Apache-服务器-1"><a href="#重启-Apache-服务器-1" class="headerlink" title="重启 Apache 服务器"></a>重启 Apache 服务器</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl restart httpd</span><br></pre></td></tr></table></figure>

<h2 id="访问-phpMyAdmin"><a href="#访问-phpMyAdmin" class="headerlink" title="访问 phpMyAdmin"></a>访问 phpMyAdmin</h2><p>在浏览器输入 <a target="_blank" rel="noopener" href="http://127.0.0.1/phpMyAdmin">http://127.0.0.1/phpMyAdmin</a> 登录 phpMyAdmin：</p>
<p><a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3644091757.png"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3644091757.png" alt="3644091757.png"></a></p>
<h1 id="安装-WordPress"><a href="#安装-WordPress" class="headerlink" title="安装 WordPress"></a>安装 WordPress</h1><h2 id="创建-WordPress-数据库"><a href="#创建-WordPress-数据库" class="headerlink" title="创建 WordPress 数据库"></a>创建 WordPress 数据库</h2><p>登录 MariaDB</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mysql -u root -p</span><br></pre></td></tr></table></figure>

<p>创建 wordpress 数据库并创建访问帐号。</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"># 创建数据库</span><br><span class="line"><span class="keyword">CREATE</span> DATABASE wordpress;</span><br><span class="line"></span><br><span class="line"># 创建数据库用户和密码</span><br><span class="line"><span class="keyword">CREATE</span> <span class="keyword">USER</span> wordpressuser<span class="variable">@localhost</span> IDENTIFIED <span class="keyword">BY</span> <span class="string">&#x27;wordress_password&#x27;</span>;</span><br><span class="line"></span><br><span class="line"># 设置 wordpressuser访问 wordpress 数据库权限</span><br><span class="line"><span class="keyword">GRANT</span> <span class="keyword">ALL</span> PRIVILEGES <span class="keyword">ON</span> wordpress.<span class="operator">*</span> <span class="keyword">TO</span> wordpressuser<span class="variable">@localhost</span> IDENTIFIED <span class="keyword">BY</span> <span class="string">&#x27;wordress_password&#x27;</span>;</span><br><span class="line"></span><br><span class="line"># 刷新数据库设置</span><br><span class="line">FLUSH PRIVILEGES;</span><br><span class="line"></span><br><span class="line"># 退出数据库</span><br><span class="line">exit</span><br></pre></td></tr></table></figure>

<h2 id="下载安装-WordPress"><a href="#下载安装-WordPress" class="headerlink" title="下载安装 WordPress"></a>下载安装 WordPress</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 下载安装包（WordPress 没有中文发行包，需要通过后续配置下载中文语言包）。</span></span><br><span class="line">wget https://wordpress.org/latest.tar.gz</span><br><span class="line"></span><br><span class="line"><span class="comment"># 解压 wordpress</span></span><br><span class="line">tar xzvf latest.tar.gz</span><br><span class="line"></span><br><span class="line"><span class="comment"># 复制到 /var/www/html/wordpress 目录</span></span><br><span class="line">sudo rsync -avP ~/wordpress/ /var/www/html/wordpress/</span><br></pre></td></tr></table></figure>

<h2 id="编辑-wp-config-php-文件"><a href="#编辑-wp-config-php-文件" class="headerlink" title="编辑 wp-config.php 文件"></a>编辑 wp-config.php 文件</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 切换到wordpress目录</span></span><br><span class="line"><span class="built_in">cd</span> /var/www/html/wordpress</span><br><span class="line"></span><br><span class="line"><span class="comment"># 复制wp-config.php文件</span></span><br><span class="line"><span class="built_in">cp</span> wp-config-sample.php wp-config.php</span><br><span class="line"></span><br><span class="line"><span class="comment"># 编辑wp-config.php文件</span></span><br><span class="line">sudo nano wp-config.php</span><br></pre></td></tr></table></figure>

<p>配置数据库和中文语言包选项相关信息：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// ** MySQL settings - You can get this info from your web host ** //</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/** The name of the database for WordPress */</span></span><br><span class="line"><span class="title function_ invoke__">define</span>(<span class="string">&#x27;DB_NAME&#x27;</span>, <span class="string">&#x27;database_name_here&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">/** MySQL database username */</span></span><br><span class="line"><span class="title function_ invoke__">define</span>(<span class="string">&#x27;DB_USER&#x27;</span>, <span class="string">&#x27;username_here&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">/** MySQL database password */</span></span><br><span class="line"><span class="title function_ invoke__">define</span>(<span class="string">&#x27;DB_PASSWORD&#x27;</span>, <span class="string">&#x27;password_here&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">/** MySQL hostname */</span></span><br><span class="line"><span class="title function_ invoke__">define</span>(<span class="string">&#x27;DB_HOST&#x27;</span>, <span class="string">&#x27;localhost&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">/** 设置简体中文语言，如无此选项增加即可 */</span></span><br><span class="line"><span class="title function_ invoke__">define</span>(<span class="string">&#x27;WPLANG&#x27;</span>,<span class="string">&#x27;zh_CN&#x27;</span>);</span><br></pre></td></tr></table></figure>

<h2 id="安装和配置-WordPress"><a href="#安装和配置-WordPress" class="headerlink" title="安装和配置 WordPress"></a>安装和配置 WordPress</h2><h3 id="安装-WordPress-1"><a href="#安装-WordPress-1" class="headerlink" title="安装 WordPress"></a>安装 WordPress</h3><p>浏览器打开：<a target="_blank" rel="noopener" href="http://127.0.0.1/wordpress/wp-admin/install.php">http://127.0.0.1/wordpress/wp-admin/install.php</a> 进入安装程序，安装完成后即可登录后台管理系统。</p>
<p><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/326059876.png" alt="326059876.png"></p>
<h3 id="设置-WordPress-语言为简体中文"><a href="#设置-WordPress-语言为简体中文" class="headerlink" title="设置 WordPress 语言为简体中文"></a>设置 WordPress 语言为简体中文</h3><blockquote>
<p>再 <code>Site Language</code> 中选择简体中文（如无简体中文选项，请先配置 <code>wp-config.php</code> 文件中 <code>WPLANG</code> 为 <code>zh_CN</code>。），保存后系统会自动下载简体中文语言包。</p>
</blockquote>
<p><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/795327484.png" alt="795327484.png"></p>
<h3 id="设置-WordPress-Url-重写配置"><a href="#设置-WordPress-Url-重写配置" class="headerlink" title="设置 WordPress Url 重写配置"></a>设置 WordPress Url 重写配置</h3><p>默认情况下 WordPress 会自动配置 Url 重写的站点配置文件<code>.htaccess</code>。如果系统安装好后无法启用固定链接，请检查<code>网站目录</code>（不建议放在网站根目录）下是否存在配置文件 <code>.htaccess</code>，如果没有需要新建该文件并输入以下文件内容：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&lt;IfModule</span> <span class="string">mod_rewrite.c&gt;</span></span><br><span class="line">    <span class="string">RewriteEngine</span> <span class="string">On</span></span><br><span class="line">    <span class="string">RewriteCond</span> <span class="string">%&#123;REQUEST_FILENAME&#125;</span> <span class="string">!-f</span></span><br><span class="line">    <span class="string">RewriteCond</span> <span class="string">%&#123;REQUEST_FILENAME&#125;</span> <span class="string">!-d</span></span><br><span class="line">    <span class="string">RewriteRule</span> <span class="string">^(.*)$</span> <span class="string">index.php</span> [<span class="string">L</span>]</span><br><span class="line"></span><br><span class="line"><span class="string">&lt;/IfModule&gt;</span></span><br></pre></td></tr></table></figure>

<h2 id="更新出现-ftp-设置"><a href="#更新出现-ftp-设置" class="headerlink" title="更新出现 ftp 设置"></a>更新出现 ftp 设置</h2><p>点击<code>系统更新</code>或<code>查看系统更新进度</code>会出现 ftp 设置窗口，这是因为 WordPress 所在文件夹所属权限非 Apache 用户，系统不能自动更新。因此需要通过以下指令修改 WordPress 所在文件夹的所有者。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 进入 WordPress 安装目录</span></span><br><span class="line"><span class="built_in">cd</span> /var/www/html/wordpress</span><br><span class="line"></span><br><span class="line"><span class="comment"># 修改当前文件夹的所属用户为 apache</span></span><br><span class="line">sudo <span class="built_in">chown</span> -R apache:apache ./</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看当前文件夹所有者</span></span><br><span class="line"><span class="built_in">ls</span> -l</span><br></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3081847649.png" alt="3081847649.png"></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://www.aikiki.top">樵子</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://www.aikiki.top/post/e4e5/">https://www.aikiki.top/post/e4e5/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://www.aikiki.top" target="_blank">AiKIKI</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/CentOS/">CentOS</a><a class="post-meta__tags" href="/tags/WordPress/">WordPress</a><a class="post-meta__tags" href="/tags/Apache/">Apache</a><a class="post-meta__tags" href="/tags/MariaDB/">MariaDB</a><a class="post-meta__tags" href="/tags/PHP/">PHP</a><a class="post-meta__tags" href="/tags/phpMyAdmin/">phpMyAdmin</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-full"><a href="/post/52e3/" title="CentOS 7 搭建 LNMP 环境"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">CentOS 7 搭建 LNMP 环境</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/post/52e3/" title="CentOS 7 搭建 LNMP 环境"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-05-26</div><div class="title">CentOS 7 搭建 LNMP 环境</div></div></a></div><div><a href="/post/6f9d/" title="Docker 搭建 DNMP 环境"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/docker-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-03-22</div><div class="title">Docker 搭建 DNMP 环境</div></div></a></div><div><a href="/post/1952/" title="谷歌云 Compute Engine 安装 CentOS 7 总结"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-05-28</div><div class="title">谷歌云 Compute Engine 安装 CentOS 7 总结</div></div></a></div><div><a href="/post/dab6/" title="使用 Windows 自带的远程桌面 mstsc 连接 CentOS 7"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-06-20</div><div class="title">使用 Windows 自带的远程桌面 mstsc 连接 CentOS 7</div></div></a></div><div><a href="/post/a3e5/" title="CentOS 7 清理开机启动项"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-03-14</div><div class="title">CentOS 7 清理开机启动项</div></div></a></div><div><a href="/post/def6/" title="使用 Windows 自带的远程桌面 mstsc 连接 CentOS 8"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-09</div><div class="title">使用 Windows 自带的远程桌面 mstsc 连接 CentOS 8</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/avatar.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">樵子</div><div class="author-info__description">Always CREATIVE.</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">28</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/acmeist"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/acmeist" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:huweighost@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a><a class="social-icon" href="/atom.xml" target="_blank" title="Rss"><i class="fas fa-rss"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">感謝訪問本站，若喜歡請收藏 ^_^</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-Apache-web-%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-number">1.</span> <span class="toc-text">安装 Apache web 服务器</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-Apache-web-%E6%9C%8D%E5%8A%A1%E5%99%A8-1"><span class="toc-number">1.1.</span> <span class="toc-text">安装 Apache web 服务器</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-Apache-%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-number">1.2.</span> <span class="toc-text">配置 Apache 服务器</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8-Apache-%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%B9%B6%E8%AE%BE%E7%BD%AE%E4%B8%BA%E5%BC%80%E6%9C%BA%E5%90%AF%E5%8A%A8"><span class="toc-number">1.3.</span> <span class="toc-text">启动 Apache 服务器并设置为开机启动</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Apache-%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%B5%8B%E8%AF%95"><span class="toc-number">1.4.</span> <span class="toc-text">Apache 服务器测试</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-MariaDB-%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">2.</span> <span class="toc-text">安装 MariaDB 数据库</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-MariaDB-%E6%95%B0%E6%8D%AE%E5%BA%93-1"><span class="toc-number">2.1.</span> <span class="toc-text">安装 MariaDB 数据库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8-MariaDB-%E6%95%B0%E6%8D%AE%E5%BA%93%E5%B9%B6%E8%AE%BE%E7%BD%AE%E4%B8%BA%E5%BC%80%E6%9C%BA%E5%90%AF%E5%8A%A8"><span class="toc-number">2.2.</span> <span class="toc-text">启动 MariaDB 数据库并设置为开机启动</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AE%89%E5%85%A8%E8%84%9A%E6%9C%AC"><span class="toc-number">2.3.</span> <span class="toc-text">安装数据库安全脚本</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-PHP5-6"><span class="toc-number">3.</span> <span class="toc-text">安装 PHP5.6</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9F%A5%E8%AF%A2%E8%BD%AF%E4%BB%B6%E5%8C%85"><span class="toc-number">3.1.</span> <span class="toc-text">查询软件包</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%A7%BB%E9%99%A4%E7%B3%BB%E7%BB%9F%E5%B7%B2%E7%BB%8F%E5%AE%89%E8%A3%85%E7%9A%84-PHP"><span class="toc-number">3.2.</span> <span class="toc-text">移除系统已经安装的 PHP</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-CentOS-7-%E9%AB%98%E7%89%88%E6%9C%AC-PHP-%E7%9A%84%E6%BA%90"><span class="toc-number">3.3.</span> <span class="toc-text">配置 CentOS 7 高版本 PHP 的源</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-PHP-5-6"><span class="toc-number">3.4.</span> <span class="toc-text">安装 PHP 5.6</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B-PHP-%E5%AE%89%E8%A3%85%E7%89%88%E6%9C%AC"><span class="toc-number">3.5.</span> <span class="toc-text">查看 PHP 安装版本</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%87%8D%E5%90%AF-Apache-%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-number">3.6.</span> <span class="toc-text">重启 Apache 服务器</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA-PHP-%E6%B5%8B%E8%AF%95%E9%A1%B5%E9%9D%A2"><span class="toc-number">3.7.</span> <span class="toc-text">创建 PHP 测试页面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95-Apache-%E6%9C%8D%E5%8A%A1%E5%99%A8-PHP"><span class="toc-number">3.8.</span> <span class="toc-text">测试 Apache 服务器 PHP</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%99%84%EF%BC%9A%E9%85%8D%E7%BD%AE-Apache-%E4%BB%A5-FastCGI-%E8%BF%90%E8%A1%8C-PHP"><span class="toc-number">3.9.</span> <span class="toc-text">附：配置 Apache 以 FastCGI 运行 PHP</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-phpMyAdmin"><span class="toc-number">4.</span> <span class="toc-text">安装 phpMyAdmin</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-phpMyAdmin-1"><span class="toc-number">4.1.</span> <span class="toc-text">安装 phpMyAdmin</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-phpMyAdmin-%E7%9A%84-httpd"><span class="toc-number">4.2.</span> <span class="toc-text">配置 phpMyAdmin 的 httpd</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%87%8D%E5%90%AF-Apache-%E6%9C%8D%E5%8A%A1%E5%99%A8-1"><span class="toc-number">4.3.</span> <span class="toc-text">重启 Apache 服务器</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%BF%E9%97%AE-phpMyAdmin"><span class="toc-number">4.4.</span> <span class="toc-text">访问 phpMyAdmin</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-WordPress"><span class="toc-number">5.</span> <span class="toc-text">安装 WordPress</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA-WordPress-%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">5.1.</span> <span class="toc-text">创建 WordPress 数据库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85-WordPress"><span class="toc-number">5.2.</span> <span class="toc-text">下载安装 WordPress</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BC%96%E8%BE%91-wp-config-php-%E6%96%87%E4%BB%B6"><span class="toc-number">5.3.</span> <span class="toc-text">编辑 wp-config.php 文件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AE-WordPress"><span class="toc-number">5.4.</span> <span class="toc-text">安装和配置 WordPress</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-WordPress-1"><span class="toc-number">5.4.1.</span> <span class="toc-text">安装 WordPress</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE-WordPress-%E8%AF%AD%E8%A8%80%E4%B8%BA%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87"><span class="toc-number">5.4.2.</span> <span class="toc-text">设置 WordPress 语言为简体中文</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE-WordPress-Url-%E9%87%8D%E5%86%99%E9%85%8D%E7%BD%AE"><span class="toc-number">5.4.3.</span> <span class="toc-text">设置 WordPress Url 重写配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9B%B4%E6%96%B0%E5%87%BA%E7%8E%B0-ftp-%E8%AE%BE%E7%BD%AE"><span class="toc-number">5.5.</span> <span class="toc-text">更新出现 ftp 设置</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/post/c3b4/" title="Docker 使用宿主机网段"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/docker-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="Docker 使用宿主机网段"/></a><div class="content"><a class="title" href="/post/c3b4/" title="Docker 使用宿主机网段">Docker 使用宿主机网段</a><time datetime="2023-12-18T01:27:00.000Z" title="发表于 2023-12-18 09:27:00">2023-12-18</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/1e36/" title="ESXi 远程 SSH 终端登录显示器管理界面"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/esxi-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="ESXi 远程 SSH 终端登录显示器管理界面"/></a><div class="content"><a class="title" href="/post/1e36/" title="ESXi 远程 SSH 终端登录显示器管理界面">ESXi 远程 SSH 终端登录显示器管理界面</a><time datetime="2023-11-29T01:45:00.000Z" title="发表于 2023-11-29 09:45:00">2023-11-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/9973/" title="ESXi 6.7 自动关机设置"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/esxi-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="ESXi 6.7 自动关机设置"/></a><div class="content"><a class="title" href="/post/9973/" title="ESXi 6.7 自动关机设置">ESXi 6.7 自动关机设置</a><time datetime="2023-11-25T07:12:00.000Z" title="发表于 2023-11-25 15:12:00">2023-11-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/bf0c/" title="OpenWrt 安装自带 Tailscale 和 ZeroTier"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/openwrt-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="OpenWrt 安装自带 Tailscale 和 ZeroTier"/></a><div class="content"><a class="title" href="/post/bf0c/" title="OpenWrt 安装自带 Tailscale 和 ZeroTier">OpenWrt 安装自带 Tailscale 和 ZeroTier</a><time datetime="2023-11-21T01:19:00.000Z" title="发表于 2023-11-21 09:19:00">2023-11-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/53a7/" title="OpenWrt 更新所有已安装软件包"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/openwrt-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="OpenWrt 更新所有已安装软件包"/></a><div class="content"><a class="title" href="/post/53a7/" title="OpenWrt 更新所有已安装软件包">OpenWrt 更新所有已安装软件包</a><time datetime="2023-11-15T01:38:00.000Z" title="发表于 2023-11-15 09:38:00">2023-11-15</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By 樵子</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a target="_blank" rel="noopener" href="https://beian.miit.gov.cn/"><img class="icp-icon" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/icp.png"><span>渝ICP备19007019号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"></div><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>